<template>
  <el-dialog
    :title="'护理级别关联'"
    :close-on-click-modal="false"
    :visible.sync="visible">
    <el-table
      :data="tableData"
      style="width: 100%">
      <el-table-column
        prop="id"
        label="序号"
        >
      </el-table-column>


      <el-table-column
        prop="serialnumber"
        label="编号"
        >
      </el-table-column>
          
      <el-table-column
        prop="nursingname"
        label="名称"
        >
      </el-table-column>

          
      <el-table-column
        prop="serviceprice"
        label="价格"
        >
      </el-table-column>
          
      <el-table-column
        prop="executioncycle"
        label="执行周次"
        >
      </el-table-column>

          
      <el-table-column
        prop="executiontimes"
        label="执行次数"
        >
      </el-table-column>

      <el-table-column
        align="center"
        label="操作">
        
          <template slot-scope="scope" >
          <el-button type="text" size="mini" @click="deleteHandle(scope.row.id)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    

  </el-dialog>
</template>

<script>
  export default {
    data () {
      return {
        visible: false,
        
         tableData: [],
          levelId: 0 
        }
       
        
        },
    methods: {
     deleteHandle(itemId) {
      this.$nextTick(() => {
        this.$http({
          url: this.$http.adornUrl(`/nurselevel/nurselevel/deleteNurseLevel/${this.levelId}/${itemId}`),
          method: 'get',
        }).then(({ data }) => {
          if (data && data.code === 0) {
            this.$message.success("删除成功")
             this.visible = false

          }
        })
      })
    },
      init (id) {
        this.visible = true
        this.levelId=id
        this.$nextTick(() => {
            this.$http({
              url: this.$http.adornUrl(`/nurselevel/nurselevel/nurseContentByLevelId/${id}`),
              method: 'get',
              params: this.$http.adornParams()
            }).then(({data}) => {
              if (data && data.code === 0) {
                console.log(data.nurseContentList)
                this.tableData=data.nurseContentList
              }
            })
          }


        )
      }
      
    }
  }
</script>
